//
//  Types.h
//  Simulation
//
//  Created by Christopher Kemsley on 2/24/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#ifndef Simulation_Types_h
#define Simulation_Types_h

#include <string>
#include "Exception.hpp"
#include "Object.hpp"

NamespaceBegin










typedef unsigned char	Byte ;
typedef unsigned		Length ;
typedef double			Distance ;

typedef unsigned long	Rate ;








struct	Interval
{
	Interval	() ;
	Interval	( Interval const & copy ) ;
	Interval	( double seconds ) ;
	Interval	( unsigned long seconds , unsigned long microseconds , unsigned long picoseconds ) ;
	~Interval	() ;
	
	static Interval const	distantFuture ;
	static Interval const	zeroTime ;
	
	
	
	double			secondsValue () const ;
	bool			isNegative () const ;
	
	Interval&		operator=	( Interval const & copy ) ;
	
	Interval const	operator+	( Interval const & copy ) const ;
	Interval const	operator-	( Interval const & copy ) const ;
	
	Interval const	operator*	( unsigned const & copy ) const ;
	
	Interval&		operator+=	( Interval const & copy ) ;
	Interval&		operator-=	( Interval const & copy ) ;
	
	bool			operator==	( Interval const & compare ) const ;
	bool			operator!=	( Interval const & compare ) const ;
	
	bool			operator>=	( Interval const & compare ) const ;
	bool			operator<=	( Interval const & compare ) const ;
	
	bool			operator>	( Interval const & compare ) const ;
	bool			operator<	( Interval const & compare ) const ;
	
	
	// Structure
private:
	long	mSeconds ;
	long	mMicroseconds ;
	long	mPicoseconds ;
	
	void	_compressDownward () ;
	void	_compressUpward () ;
	
	friend std::ostream&	operator<<	( std::ostream & stream , Interval const & interval ) ;
};














struct	Location
{
	Location	() ;
	Location	( double const & inX , double const & inY ) ;
	Location	( Location const & copy ) ;
	~Location	() ;
	
	double	x ;
	double	y ;
	
	double	distanceFrom	( Location const & other ) const ;
	
	bool	operator==		( Location const & compare ) const ;
	
	Location& operator=		( Location const & copy ) ;
	
	
private:
	friend std::ostream&	operator<<	( std::ostream & stream , Location const & location ) ;
} ;












struct	Channel
{
	typedef unsigned Identifier ;
	
	Channel		() ;
	Channel		( Channel const & copy ) ;
	Channel		( Identifier inIdentifier ) ;
	~Channel	() ;
	
	Identifier	identifier ;
	
	Channel&	operator=		( Channel const & copy ) ;
	
	bool		operator==		( Channel const & compare ) const ;
	
	
	static Identifier const	Unidentified	=	-1 ;
	
	
private:
	friend std::ostream&	operator<<	( std::ostream & stream , Channel const & channel ) ;
} ;


















NamespaceEnd
#endif
